// Created by Windward Studios - no copyright is claimed. This code can be used in
// any manner by anyone for any reason. There is no copyright of any kind on it. You may
// use it in commercial products. You may change it without sharing those changes.
// We ask that you keep the "created by Windward Studios" in a comment at the top.

using System;
using System.Data;

namespace net.windward.utils.ado.MySql
{
	/// <summary>
	/// Wrap an IDataReader returned on a SqlServer Execute. All this does is add the GetTimestamp method.
	/// </summary>
	public class WrMySqlDataReader : WrDataReader
	{

		/// <summary>
		/// Create a WrDataReader object wrapping an IDataReader.
		/// </summary>
		/// <param name="data">The IDataReader we are wrapping.</param>
		public WrMySqlDataReader(IDataReader data)
			: base(data)
		{
		}

		/// <summary>
		/// Read a timestamp field and return it as an Int64.
		/// </summary>
		/// <param name="ordinal">The ordinal of the timestamp column.</param>
		/// <returns>The timestamp with [0] as msw and [1] as lsw.</returns>
		public override long GetTimestamp(int ordinal)
		{

			DateTime dt = reader.GetDateTime(ordinal);
			return dt.Ticks;
		}
	}
}
